package com.guage.producter.service.impl;

import java.text.ParseException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guage.producter.domain.Student;
import com.guage.producter.domain.Students;
import com.guage.producter.domain.StudentsKey;
import com.guage.producter.mapper.StudentMapper;
import com.guage.producter.service.StudentService;
@Service
public class StudentServiceImpl implements StudentService {

    StudentMapper studentMapper;
    @Autowired
    public void setStudentMapper(StudentMapper studentMapper) {
        this.studentMapper = studentMapper;
    }

    @Override
    public int insert(Student student) throws ParseException {
        int insert = studentMapper.insert(student);
        return insert;
    }

    @Override
    public int deleteStu(Integer id) {
        int delete = studentMapper.delete(id);
        return delete;
    }

    @Override
    public int updateStu(Student student) {
        int update = studentMapper.update(student);
        return update;
    }

    @Override
    public List<Student> findAll() {
        return studentMapper.findAll();
    }

    @Override
    public PageInfo<Student> findByPage(Student student, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Student> byPage = studentMapper.findByPage(student);
        PageInfo pageInfo=new PageInfo(byPage);
        return pageInfo;

    }

    @Override
    public Student findById(Integer id) {
        return studentMapper.findById(id);
    }
}
